/**
 * @description Fixture all api when mock
 */

import MockAdapter from 'axios-mock-adapter'
import instance from '@api/instance'

import login from './login'
import menu from './menu'
import userCenter from './userCenter'
import dashboard from './dashboard'

const mockAdapter = new MockAdapter(instance)

const apis = []
  .concat(login)
  .concat(menu)
  .concat(userCenter)
  .concat(dashboard)

apis.forEach(api => {
  switch (api.method) {
    case 'get':
      mockAdapter.onGet(api.url).reply(200, api.response)
      break
    case 'post':
      mockAdapter.onPost(api.url).reply(200, api.response)
      break
    default:
      break
  }
})
mockAdapter.onAny().passThrough()
